#!/bin/bash
#=======================
# Author : Ali Moradzade
# Created: 2022/01/27
#=======================

# Big Users - Find big disk space user in vaious directories

# ===============================================
# parameters for script

CHECK_DIRECTORIES=" /var/log /home" 

# ===============================================
# main script

DATE=$(date '+%m%d%y')

exec > disk_space_$DATE.rpt

echo "Top Ten Disk Space Usage"
echo "for $CHECK_DIRECTORIES Directories"

for DIR_CHECK in $CHECK_DIRECTORIES
do
	echo ""
	echo "The $DIR_CHECK Directory:"

	du -S $DIR_CHECK 2>/dev/null |
		sort -rn |
		sed '{11,$D; =}' |
		sed 'N; s/\n/ /' |
		gawk '{printf $1":\t"$2"\t"$3"\n"}'
done
